﻿

namespace Amplify.Twitter
{
	using System;
	using System.Collections.Generic;
	using System.Net;
	using System.Linq;
	using System.Runtime.Serialization;
	using System.Text;

	/// <summary>
	/// A Twitter Exception that wraps errors from the twitter server along with other misc errors such
	/// as writing a message that is over 140 characters long. 
	/// </summary>
	public class TwitterException :  System.Exception 
	{

		/// <summary>
		/// Initializes a new instance of the <see cref="TwitterException"/> class.
		/// </summary>
		public TwitterException()
			: base()
		{

		}

		/// <summary>
		/// Initializes a new instance of the <see cref="TwitterException"/> class.
		/// </summary>
		/// <param name="message">The message.</param>
		/// <param name="code">The code.</param>
		/// <param name="url">The URL.</param>
		public TwitterException(string message, HttpStatusCode code, string url)
			: base(message)
		{
			this.Code = code;
			this.Url = url;
		}

		/// <summary>
		/// Initializes a new instance of the <see cref="TwitterException"/> class.
		/// </summary>
		/// <param name="message">The message.</param>
		public TwitterException(string message)
			: base(message)
		{

		}

		/// <summary>
		/// Initializes a new instance of the <see cref="TwitterException"/> class.
		/// </summary>
		/// <param name="message">The message.</param>
		/// <param name="innerException">The inner exception.</param>
		public TwitterException(string message, Exception innerException)
			: base(message, innerException)
		{

		}

		/// <summary>
		/// Initializes a new instance of the <see cref="TwitterException"/> class.
		/// </summary>
		/// <param name="info">The <see cref="T:System.Runtime.Serialization.SerializationInfo"/> that holds the serialized object data about the exception being thrown.</param>
		/// <param name="context">The <see cref="T:System.Runtime.Serialization.StreamingContext"/> that contains contextual information about the source or destination.</param>
		/// <exception cref="T:System.ArgumentNullException">The <paramref name="info"/> parameter is null. </exception>
		/// <exception cref="T:System.Runtime.Serialization.SerializationException">The class name is null or <see cref="P:System.Exception.HResult"/> is zero (0). </exception>
		public TwitterException(SerializationInfo info, StreamingContext context)
			: base(info, context)
		{

		}

		/// <summary>
		/// Gets or sets the code.
		/// </summary>
		/// <value>The code.</value>
		public HttpStatusCode Code { get; set; }

		/// <summary>
		/// Gets or sets the URL.
		/// </summary>
		/// <value>The URL.</value>
		public string Url { get; set; }

		
 	}
}
